package tool

import (
	"github.com/gin-gonic/gin"
	"net/http"
)

const (
	SUCCESS int = 1
	FAILD   int = 0
)

//操作成功返回
func Success(ctx *gin.Context, v interface{}) {
	ctx.JSON(http.StatusOK, map[string]interface{}{
		"code": SUCCESS,
		"msg":  "success",
		"data": v,
	})

}

//操作失败返回
func Faild(ctx *gin.Context, v interface{}) {
	ctx.JSON(200, map[string]interface{}{
		"code": FAILD,
		"msg":  "faild",
		"data": v,
	})

}
